package com.example.demo.alarm.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.demo.alarm.service.AlarmListService;
import com.example.demo.system.utility.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 报警管理/综合看板
 */
@RequestMapping("alarmList")
@RestController
public class AlarmListController {

    @Autowired
    private AlarmListService alarmListService;

    //报警管理-报警列表
    @RequestMapping("getList")
    public Result getList(@RequestParam(value = "pageNum") Integer pageNum,
                          @RequestParam(value = "pageSize") Integer pageSize,
                          @RequestParam(value = "name", required = false) String name,
                          @RequestParam(value = "startTime", required = false) String startTime,
                          @RequestParam(value = "endTime", required = false) String endTime) {
        return alarmListService.getList(pageNum, pageSize, name, startTime, endTime);
    }

    //获取报警数据详情
    @RequestMapping("get")
    public Result get(Integer id) {
        return alarmListService.get(id);
    }

    //综合看板
    @RequestMapping("integratedSignage")
    public Result integratedSignage(String spaceName) {
        return alarmListService.integratedSignage(spaceName);
    }

    //综合看板
    @RequestMapping("getHealthOrComfort")
    public Result getHealthOrComfort(String spaceName) {
        return alarmListService.getHealthOrComfort(spaceName);
    }




    //测试推送，接收其他系统推送的数据
    @GetMapping("getPushData")
    public String getPushData() {
        System.err.println("5555555");
        return "测试推送数据aaaaaaaaa";
        //return JSONObject.toJSONString(taskModel2);
    }
}
